<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>Title</title>
    <script type="text/javascript" src="../js/jquery-3.0.0.js"></script>
    <script>
        function dodo() {
		  var ffs = {
			string:'String',
			integer:'int',
		  };
          var results = '';
          var content = $('#content').val().trim();
          $('#content').val(content);

          var rows = content.split('\n');

		  var noteIndex = $("#note").val();
		  var variableTypeIndex = $("#variableType").val();
		  var variableIndex = $("#variable").val();
		  
          for (var i = 0; i < rows.length; i++) {
          	var lines = rows[i].trim().split('\t');
			for(var j = 0; j < lines.length; j++){
				lines[j] = $.trim(lines[j]);
			}
			if("string" === lines[variableTypeIndex].toLowerCase()){
				lines[variableTypeIndex] = "String";
			}
          	results += '/** ' + lines[noteIndex] + ' */\n';

          	results += 'private ';
          	results += type(lines[variableTypeIndex]);
          	results += ' ';
          	results += lines[variableIndex];
          	results += ';\n';

          }
          $('#show').val(results);
        }

        function type(obj){
        	if("Long" === obj){
        		return obj.toLowerCase();
        	}
        	return obj;
        }
    </script>
</head>
<body>
    <textarea id="content" cols="50" rows="20">

    </textarea>

    <textarea id="show" cols="50" rows="20">

    </textarea>
    <br/>

	<label for="variable">变量名</label>
	<input id="variable" type="textarea" rows="1" cols="1" value="0">
	<label for="variableType">类型</label>
	<input id="variableType" type="textarea" rows="1" cols="1" value="2">
	<label for="note">注释</label>
	<input id="note" type="textarea" rows="1" cols="1" value="3">
	
	<br/>
    <button onclick="dodo()">计算</button>
    <br/>
</body>
</html>